package org.ncibi.cytoscape.metscape.multidisplay;

public class Study {

	private double minValue = Double.NaN;
	private double maxValue = Double.NaN;
	private String name;

	public Study(String lable) {
		name = lable;
	}
	
	public boolean equals(Object o){
		if (!(o instanceof Study)) return false;
		return ((Study)o).name.equals(this.name);
	}

	public String toString(){
		return name;
	}

	public String getLabel() {
		return name;
	}

	public void updateMinMax(double v) {
		updateMin(v);
		updateMax(v);
	}
	
	public double getMinValue() {
		return minValue;
	}

	public double getMaxValue() {
		return maxValue;
	}

	private void updateMin(double value){
		if (Double.isNaN(value)) return;
		if (Double.isNaN(minValue) || (value < minValue)) minValue = value;
	}
	
	private void updateMax(double value){
		if (Double.isNaN(value)) return;
		if (Double.isNaN(maxValue) || (value > maxValue)) maxValue = value;
	}

}
